package com.fh.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author whf
 * @date 2024年05月07日 16:28
 */
@Service
public class RedisService {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    public void add(){
        redisTemplate.opsForValue().set("name","whf");
        redisTemplate.expire("name", 10, TimeUnit.SECONDS);

    }


}
